www.gusucode.com > UCMS PHP通用建站系统 v1.3.4PHP源码程序 > UCMS PHP通用建站系统 v1.3.4/ucms_v1.3.4/ucms_v1.3.4/ucms/str/cache.php
<?php if (!defined('admin')) {exit();} if(power('alevel')!=3) {adminmsg('','无权限',1);} checktoken(); $filecount=0; if(deldir(CacheDir)) { if(channelrouter()==false) { adminmsg('','写入栏目缓存失败',1); } adminmsg('','清空成功'.ifcachephpcode(),1); }else { adminmsg('','清空失败',1); } function ifcachephpcode() { $array=get_loaded_extensions(); $cached=false; foreach($array as $key=>$val) { $val=strtolower($val); if(stripos($val,'opcache')===false && stripos($val,'xcache')===false) { }else { $cached=true; } if($cached) { Return ',如新增加或编辑的栏目不能访问,请清空opcache等组件的缓存'; } } Return ''; } function deldir($dir) { global $filecount; @$dh=opendir($dir); if(!$dh) { adminmsg('','无法打开缓存目录,请设置目录权限',1); } while ($file=readdir($dh)) { if($file!="." && $file!="..") { $fullpath=$dir."/".$file; if(!is_dir($fullpath)) { unlink($fullpath); $filecount++; if($filecount>250) { closedir($dh); echo('<script type="text/javascript">document.write(" 缓存文件较多,清除中,请稍等...");window.location.reload();</script>'); exit; } } else { deldir($fullpath); } } } closedir($dh); if($dir!==CacheDir) { if(@rmdir($dir)) { $filecount++; return true; } else { adminmsg('','无法删除缓存目录'.$dir.',请设置目录权限',1); return false; } } Return true; }